RecordSource = "SELECT * FROM Authors ORDER BY Author"
Top = 120
Visible = 0 'False
Width = 1980
End
Begin VB.CommandButton cmdDone
Caption = "Do&ne"
Height = 375
Left = 3240
TabIndex = 13
TabStop = 0 'False
Top = 2160
Width = 1215
End
Begin VB.CommandButton cmdDelete
Caption = "&Delete"
Height = 375
Left = 1680
TabIndex = 12
TabStop = 0 'False
Top = 2160
Width = 1215
End
Begin VB.CommandButton cmdEdit
Caption = "&Edit"
Height = 375
Left = 120
TabIndex = 11
TabStop = 0 'False
Top = 1680
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "&Cancel"
Height = 375
Left = 3240
TabIndex = 10
TabStop = 0 'False
Top = 1680
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "&Save"
Height = 375
Left = 1680
TabIndex = 9
TabStop = 0 'False
Top = 1680
Width = 1215
End
Begin VB.CommandButton cmdAddNew
Caption = "&Add New"
Height = 375
Left = 120
TabIndex = 8
TabStop = 0 'False
Top = 2160
Width = 1215
End
Begin VB.CommandButton cmdNext
Caption = "Next =>"
Height = 255
Left = 2520
TabIndex = 7
TabStop = 0 'False
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdPrevious
Caption = "<= Previous"
Height = 255
Left = 1080
TabIndex = 6
TabStop = 0 'False
Top = 1320
Width = 1215
End
Begin VB.TextBox txtYearBorn
DataField = "Year Born"
DataSource = "datAuthors"
Height = 285
Left = 1200
Locked = -1 'True
MaxLength = 4
TabIndex = 2
Text = "Text"
Top = 840
Width = 1215
End
Begin VB.TextBox txtAuthor
DataField = "Author"
DataSource = "datAuthors"
Height = 285
Left = 1200
Locked = -1 'True
TabIndex = 1
Text = "Text2"
Top = 480
Width = 3375
End
Begin VB.TextBox txtAuthorID
DataField = "Au_ID"
DataSource = "datAuthors"
Height = 285
Left = 1200
Locked = -1 'True
TabIndex = 3
TabStop = 0 'False
Text = "Text1"
Top = 120
Width = 1215
End
Begin VB.Label Label3
Caption = "Year Born"
Height = 255
Left = 120
TabIndex = 5
Top = 840
Width = 1215
End
Begin VB.Label Label2
Caption = "Author Name"
Height = 255
Left = 120
TabIndex = 4
Top = 480
Width = 1215
End
Begin VB.Label Label1
Caption = "Author ID"
Height = 255
Left = 120
TabIndex = 0
Top = 120
Width = 1215
End
Attribute VB_Name = "frmAuthors"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
Private Const HELP_FINDER = &HB&
Private Sub ValidateData(AllOK As Boolean)
Dim Message As String
Dim InputYear As Integer, CurrentYear As Integer
AllOK = True
Message = ""
'Check for name
If Len(txtAuthor.Text) = 0 Then
Message = "You must enter an Author Name." + vbCrLf
txtAuthor.SetFocus
AllOK = False
End If
'Check length and range on Year Born
InputYear = Val(txtYearBorn.Text)
CurrentYear = Val(Format(Now, "yyyy"))
If Len(txtYearBorn.Text) <> 0 Then
If InputYear > CurrentYear Or InputYear < CurrentYear - 150 Then
Message = Message + "Year Born must be between" & Str(CurrentYear - 150) & " and" & Str(CurrentYear) & "."